/**
 * @param {number} k
 */
 var MyCircularQueue = function(k) {
    this.queue = new Array(k).fill(null);
    this.end = 0;
    this.start = -1;
};

/** 
 * @param {number} value
 * @return {boolean}
 */
MyCircularQueue.prototype.enQueue = function(value) {
    if (this.start === this.queue.length - 1) {
        return false;
    }

    this.start ++;
    this.queue[this.start] = value;
    
    return true;
};

/**
 * @return {boolean}
 */
MyCircularQueue.prototype.deQueue = function() {
    if (this.start === -1) {
        return false;
    }
    this.queue.shift();
    this.queue.push(null);
    this.start --;
    return true;
};

/**
 * @return {number}
 */
MyCircularQueue.prototype.Front = function() {
    return this.queue[this.end] === null ? -1 : this.queue[this.end];
};

/**
 * @return {number}
 */
MyCircularQueue.prototype.Rear = function() {
    return this.queue[this.start] === null || this.queue[this.start] === undefined ? -1 : this.queue[this.start];
};

/**
 * @return {boolean}
 */
MyCircularQueue.prototype.isEmpty = function() {
    return this.start === -1 ? true : false;
};

/**
 * @return {boolean}
 */
MyCircularQueue.prototype.isFull = function() {
    return this.start === this.queue.length - 1 ? true : false;
};

/**
 * Your MyCircularQueue object will be instantiated and called as such:
 * var obj = new MyCircularQueue(k)
 * var param_1 = obj.enQueue(value)
 * var param_2 = obj.deQueue()
 * var param_3 = obj.Front()
 * var param_4 = obj.Rear()
 * var param_5 = obj.isEmpty()
 * var param_6 = obj.isFull()
 */